--[[/**
-- * 
移除指定[0]BUFF,并造成[1]属性值[2]%的伤害
-- *
-- */]]

---@class BuffEffect292100 : BaseBuffEffect
BuffEffect292100 = ClientFight.CreateClass("BuffEffect292100", ClientFight.BaseBuffEffect)
local t = BuffEffect292100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local f_buffEffectValue = buff.buffBean.f_BuffEffectValue;
    if (f_buffEffectValue == nil) then
        return IBuffEffect.FAIL;
    end
    local modifiedRatio = 0;
    local calculateAttrType = 0;
    local buffList = nil;
    for i = 1, table.getn(f_buffEffectValue) - 1, 0 do
        local buffId = buff.buffBean.f_BuffEffectValue[i];
        i = i + 1;
        calculateAttrType = buff.buffBean.f_BuffEffectValue[idx];
        buffList = BuffManager.getBuffsByModel(buff.target, buffId, true, buff.source);

        if table.getn(buffList) == 0 then
            goto continue;
        else
            i = i + 1;
            for k, fighterBuff in pairs(buffList) do
                modifiedRatio = modifiedRatio + buff.buffBean.f_BuffEffectValue[i] * fighterBuff.getOverlay();
            end
            break ;
        end
        :: continue ::
    end
    if table.getn((buffList)) then
        return IBuffEffect.FAIL;
    end

    local attacker = parameters[1];
    for k, fighterBuff in pairs(buffList) do
        BuffManager.removeFighterBuff(fight, buff.target, fighterBuff, true);
    end
    if (modifiedRatio == 0) then
        return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    end
    local fightResult = parameters[3];
    local result = AttackUtils.calculateEffectDamage(buff.source, buff.target, SkillDamageTypeEnum.PHYSICS, attacker, calculateAttrType, modifiedRatio, 0);
    fightResult.setDamage(fightResult.getDamage() + result.getDamage());
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff" .. buff.modelId .. " 引爆buff,增加伤害:" .. fightResult.damage);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()